/*
 *                                                     __----~~~~~~~~~~~------___
 *                                    .  .   ~~//====......          __--~ ~~
 *                    -.            \_|//     |||\\  ~~~~~~::::... /~
 *                 ___-==_       _-~o~  \/    |||  \\            _/~~-
 *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *   .~       .~       |   \\ -_    /  /-   /   ||      \   /
 *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *           '         ~-|      /|    |-~\~~       __--~~
 *                       |-~~-_/ |    |   ~\_   _-~            /\
 *                            /  \     \__   \/~                \__
 *                        _--~ _/ | .-~~____--~-/                  ~~==.
 *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                  -_     ~\      ~~---l__i__i__i--~~_/
 *                                  _-~-__   ~)  \--______________--~~
 *                                //.-~~~-~_--~- |-------~~~~~~~~
 *                                       //.-~~~--\
 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *                               神兽保佑            永无BUG
 */

#include "./control/control.h"

// 前进
void stepper_moto_go(int32_t step, uint32_t accel, uint32_t decel, uint32_t speed)
{
    stepper_move_moto0(step, accel, decel, speed);
    stepper_move_moto1(step, accel, decel, speed);
    stepper_move_moto2(step, accel, decel, speed);
    stepper_move_moto3(step, accel, decel, speed);
}

// 后退
void stepper_moto_back(int32_t step, uint32_t accel, uint32_t decel, uint32_t speed)
{
    stepper_move_moto0(-step, accel, decel, speed);
    stepper_move_moto1(-step, accel, decel, speed);
    stepper_move_moto2(-step, accel, decel, speed);
    stepper_move_moto3(-step, accel, decel, speed);
}

// 左转
void stepper_moto_left(int32_t step, uint32_t accel, uint32_t decel, uint32_t speed)
{
    stepper_move_moto0(step, accel, decel, speed);
    stepper_move_moto1(-step, accel, decel, speed);
    stepper_move_moto2(step, accel, decel, speed);
    stepper_move_moto3(-step, accel, decel, speed);
}

// 右转
void stepper_moto_right(int32_t step, uint32_t accel, uint32_t decel, uint32_t speed)
{
    stepper_move_moto0(-step, accel, decel, speed);
    stepper_move_moto1(step, accel, decel, speed);
    stepper_move_moto2(-step, accel, decel, speed);
    stepper_move_moto3(step, accel, decel, speed);
}

// 左横移
void stepper_moto_left_shift(int32_t step, uint32_t accel, uint32_t decel, uint32_t speed)
{
    stepper_move_moto0(step, accel, decel, speed);
    stepper_move_moto1(step, accel, decel, speed);
    stepper_move_moto2(-step, accel, decel, speed);
    stepper_move_moto3(-step, accel, decel, speed);
}

// 右横移
void stepper_moto_right_shift(int32_t step, uint32_t accel, uint32_t decel, uint32_t speed)
{
    stepper_move_moto0(-step, accel, decel, speed);
    stepper_move_moto1(-step, accel, decel, speed);
    stepper_move_moto2(step, accel, decel, speed);
    stepper_move_moto3(step, accel, decel, speed);
}
